////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 
// 
// This file is part of the Microsoft .NET Micro Framework Porting Kit Code Samples and is unsupported. 
// Copyright (C) Microsoft Corporation. All rights reserved. Use of this sample source code is subject to 
// the terms of the Microsoft license agreement under which you licensed this sample source code. 
// 
// THIS SAMPLE CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 
// INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
// 
// 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

using System.Runtime.CompilerServices;
using Microsoft.SPOT.Hardware;
using System;

namespace Microsoft.SPOT.IOBusApi
{
    public static class IOBus
    {

        [MethodImplAttribute(MethodImplOptions.InternalCall)]
        extern static public long Enable(bool on);

        [MethodImplAttribute(MethodImplOptions.InternalCall)]
        extern static public long GetNodeState(int node);

        [MethodImplAttribute(MethodImplOptions.InternalCall)]
        extern static public long GetNumberOfObjects(int node);

        [MethodImplAttribute(MethodImplOptions.InternalCall)]
        extern static public long GetClass(int node, int obj);

        [MethodImplAttribute(MethodImplOptions.InternalCall)]
        extern static public long GetType(int node, int obj);

        [MethodImplAttribute(MethodImplOptions.InternalCall)]
        extern static public long GetPhyicalUnit(int node, int obj);

        [MethodImplAttribute(MethodImplOptions.InternalCall)]
        extern static public long ReadLong(int node, int obj);

        [MethodImplAttribute(MethodImplOptions.InternalCall)]
        extern static public float ReadFloat(int node, int obj);

        [MethodImplAttribute(MethodImplOptions.InternalCall)]
        extern static public void WriteLong(int node, int obj, long value);

        [MethodImplAttribute(MethodImplOptions.InternalCall)]
        extern static public void WriteFloat(int node, int obj, float value);
    }   

    public class IOBusError : NativeEventDispatcher
    {
        // Pass the name to the base so it connects to driver 
        public IOBusError(string strDrvName, ulong cycle)
            : base(strDrvName, cycle)
        {         
        }
    }

    public class IOBusCycle : NativeEventDispatcher
    {
        // Pass the name to the base so it connects to driver 
        public IOBusCycle(string strDrvName, ulong cycle)
            : base(strDrvName, cycle)
        {
        }
    }
}

